<?php
namespace Swiftx\Component\Application;
use Swiftx\Interfaces\Application\Config as ConfigInterface;

class Config implements ConfigInterface{

    /**
     * 配置数据
     * @var array
     */
    protected $data;

    /**
     * 初始化对象
     * @param array $data
     */
    public function __construct(array $data){
        $this->data = $data;
    }

    /**
     * 获取模块配置
     * @param string $packge
     * @param string $name
     * @param string $default
     * @return string
     */
    public function getBundle(string $packge, string $name, string $default=null){
        if(!isset($this->data['bundle::'.$packge])) return $default;
        if(!isset($this->data['bundle::'.$packge][$name])) return $default;
        return $this->data['bundle::'.$packge][$name];
    }

}